﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbDimensionObjectContextData : OdDbAnnotScaleObjectContextData
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbDimensionObjectContextData(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbDimensionObjectContextData_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbDimensionObjectContextData obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbDimensionObjectContextData()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbDimensionObjectContextData(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbDimensionObjectContextData cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbDimensionObjectContextData_cast(OdRxObject.getCPtr(pObj));
			OdDbDimensionObjectContextData result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbDimensionObjectContextData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbDimensionObjectContextData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbDimensionObjectContextData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbDimensionObjectContextData_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbDimensionObjectContextData_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbDimensionObjectContextData_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbDimensionObjectContextData createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbDimensionObjectContextData_createObject();
			OdDbDimensionObjectContextData result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbDimensionObjectContextData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbDimensionObjectContextData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbDimensionObjectContextData)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbObjectId blockIndex()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr cPtr = TD_DbPINVOKE.OdDbDimensionObjectContextData_blockIndex(this.swigCPtr);
			OdDbObjectId result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdDbObjectId(cPtr, true));
				result = new OdDbObjectId(cPtr, false);
			}
			else
			{
				result = new OdDbObjectId(cPtr, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setBlockIndex(OdDbObjectId arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setBlockIndex(this.swigCPtr, OdDbObjectId.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setNDBRDimBlock(OdDbBlockTableRecord arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setNDBRDimBlock(this.swigCPtr, OdDbBlockTableRecord.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdDbBlockTableRecord getNDBRDimBlock()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbDimensionObjectContextData_getNDBRDimBlock(this.swigCPtr);
			OdDbBlockTableRecord result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbBlockTableRecord)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbBlockTableRecord)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbBlockTableRecord)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool hasOverride(OdDbDimensionObjectContextData.OverrideCode arg0)
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_hasOverride(this.swigCPtr, (int)arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setOverride(OdDbDimensionObjectContextData.OverrideCode arg0, bool arg1)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setOverride(this.swigCPtr, (int)arg0, arg1);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual short dimatfit()
		{
			short result = TD_DbPINVOKE.OdDbDimensionObjectContextData_dimatfit(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool dimsoxd()
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_dimsoxd(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool dimtix()
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_dimtix(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual short dimtmove()
		{
			short result = TD_DbPINVOKE.OdDbDimensionObjectContextData_dimtmove(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool dimtofl()
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_dimtofl(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDimatfit(short arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setDimatfit(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDimsoxd(bool arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setDimsoxd(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDimtix(bool arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setDimtix(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDimtmove(short arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setDimtmove(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDimtofl(bool arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setDimtofl(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool defTextLocation()
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_defTextLocation(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGePoint2d textLocation()
		{
			OdGePoint2d result = new OdGePoint2d(TD_DbPINVOKE.OdDbDimensionObjectContextData_textLocation(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double textRotation()
		{
			double result = TD_DbPINVOKE.OdDbDimensionObjectContextData_textRotation(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool getArrowFirstIsFlipped()
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_getArrowFirstIsFlipped(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool getArrowSecondIsFlipped()
		{
			bool result = TD_DbPINVOKE.OdDbDimensionObjectContextData_getArrowSecondIsFlipped(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDefTextLocation(bool arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setDefTextLocation(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setTextLocation(OdGePoint2d arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setTextLocation(this.swigCPtr, OdGePoint2d.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setTextRotation(double arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setTextRotation(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setArrowFirstIsFlipped(bool arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setArrowFirstIsFlipped(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setArrowSecondIsFlipped(bool arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_setArrowSecondIsFlipped(this.swigCPtr, arg0);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void copyFrom(OdRxObject arg0)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_copyFrom(this.swigCPtr, OdRxObject.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbDimensionObjectContextData_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void transformBy(OdGeMatrix3d mx)
		{
			TD_DbPINVOKE.OdDbDimensionObjectContextData_transformBy(this.swigCPtr, OdGeMatrix3d.getCPtr(mx));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum OverrideCode
		{
			eDimtofl = 1,
			eDimsoxd,
			eDimatfit = 4,
			eDimtix = 8,
			eDimtmove = 16
		}
	}
}
